#include <stdio.h>

const char * month[] = {
	"January",
	"February",
	"March",
	"April",
	"May",
	"June",
	"July",
	"August",
	"September",
	"October",
	"November",
	"December"
};

const char * get_month(int m)
{
	return month[m];
}

void main()
{
	printf("month=%s\n", get_month(9));	// month=October
}

#if 0
/*
 * intel
 */
0000000000001149 <get_month>:
    1149:	f3 0f 1e fa          	endbr64 
    114d:	55                   	push   %rbp
    114e:	48 89 e5             	mov    %rsp,%rbp
    1151:	89 7d fc             	mov    %edi,-0x4(%rbp)
    1154:	8b 45 fc             	mov    -0x4(%rbp),%eax
    1157:	48 98                	cltq   
    1159:	48 8d 14 c5 00 00 00 	lea    0x0(,%rax,8),%rdx        // rdx=rax*8+0--> 9*8, 因是64bit，所以是8.
    1160:	00 
    1161:	48 8d 05 b8 2e 00 00 	lea    0x2eb8(%rip),%rax        # 4020 <month>  // 指向数据区
    1168:	48 8b 04 02          	mov    (%rdx,%rax,1),%rax
    116c:	5d                   	pop    %rbp
    116d:	c3                   	retq   

000000000000116e <main>:
    116e:	f3 0f 1e fa          	endbr64 
    1172:	55                   	push   %rbp
    1173:	48 89 e5             	mov    %rsp,%rbp
    1176:	bf 09 00 00 00       	mov    $0x9,%edi
    117b:	e8 c9 ff ff ff       	callq  1149 <get_month>
    1180:	48 89 c6             	mov    %rax,%rsi
    1183:	48 8d 3d d0 0e 00 00 	lea    0xed0(%rip),%rdi        # 205a <_IO_stdin_used+0x5a>
    118a:	b8 00 00 00 00       	mov    $0x0,%eax
    118f:	e8 bc fe ff ff       	callq  1050 <printf@plt>
    1194:	90                   	nop
    1195:	5d                   	pop    %rbp
    1196:	c3                   	retq   
    1197:	66 0f 1f 84 00 00 00 	nopw   0x0(%rax,%rax,1)
    119e:	00 00 

/*
 * arm
 */
000000000040055c <get_month>:
  40055c:	d10043ff 	sub	sp, sp, #0x10
  400560:	b9000fe0 	str	w0, [sp, #12]
  400564:	b0000080 	adrp	x0, 411000 <__libc_start_main@GLIBC_2.17>
  400568:	9100c000 	add	x0, x0, #0x30                 // 指向数据区
  40056c:	b9800fe1 	ldrsw	x1, [sp, #12]
  400570:	f8617800 	ldr	x0, [x0, x1, lsl #3]
  400574:	910043ff 	add	sp, sp, #0x10
  400578:	d65f03c0 	ret

000000000040057c <main>:
  40057c:	a9bf7bfd 	stp	x29, x30, [sp, #-16]!
  400580:	910003fd 	mov	x29, sp
  400584:	52800120 	mov	w0, #0x9                   	// #9
  400588:	97fffff5 	bl	40055c <get_month>
  40058c:	aa0003e1 	mov	x1, x0
  400590:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  400594:	911b6000 	add	x0, x0, #0x6d8
  400598:	97ffffae 	bl	400450 <printf@plt>
  40059c:	d503201f 	nop
  4005a0:	a8c17bfd 	ldp	x29, x30, [sp], #16
  4005a4:	d65f03c0 	ret


#endif


